package com.blog.entity;


import com.blog.basic.domain.BasicDomain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data//生成getter,setter ,toString等函数
@NoArgsConstructor
@AllArgsConstructor
public class Article  extends BasicDomain {
    private String title;
    private String content;
    private String summary;
    private Date createTime=new Date();
    private String category;
    private Integer categoryId;
    /**
     * 时间格式化
     * @return
     */
    public String getTime(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return  simpleDateFormat.format(this.createTime);
    }
    /**
     * 时间格式化
     * @return
     */
    public String setTime(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return  simpleDateFormat.format(new Date());
    }

}
